<!--
*
* Copyright 2015 HISP Tanzania
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* @since 2015
* @author Joseph Chingalo profschingalo@gmail.com>
*
*
-->
<ion-grid>

  <div *ngIf="sendDataViaSmsObject && sendDataViaSmsObject.isLoading">
    <loading [loadingMessage]="sendDataViaSmsObject.loadingMessage" [loadingSize]="'large'"></loading>
  </div>
  <div *ngIf="sendDataViaSmsObject && !sendDataViaSmsObject.isLoading">
    <ion-row>
      <ion-col>
        <div class="item-card" color="font-color" ion-button clear full text-center text-capitalize (tap)="openOrganisationUnitTree()">
          <img class="side-menu-icon" [src]="icons.orgUnit" />&nbsp;&nbsp; {{
          (translationMapper[organisationUnitLabel])? translationMapper[organisationUnitLabel] :organisationUnitLabel
          }}
        </div>
        <div class="item-card" color="font-color" ion-button clear full text-center text-capitalize (tap)="openEntryFormList()">
          <img class="side-menu-icon" [src]="icons.dataSet" />&nbsp;&nbsp; {{ (translationMapper[dataSetLabel])?
          translationMapper[dataSetLabel] :dataSetLabel }}
        </div>
        <div class="item-card" color="font-color" ion-button clear full text-center text-capitalize (tap)="openPeriodList()">
          <img class="side-menu-icon" [src]="icons.period" />&nbsp;&nbsp; {{ (translationMapper[periodLabel])?
          translationMapper[periodLabel] :periodLabel }}
        </div>
        <div *ngIf="selectedPeriod && selectedPeriod.iso && dataSetCategoryCombo && dataSetCategoryCombo.id ">
          <div *ngIf="isDataSetDimensionApplicable">
            <div *ngFor="let category of dataSetCategoryCombo.categories;let categoryIndex = index">
              <div (tap)="openDataDimensionSelection(category)" padding-top padding-bottom class="item-card" color="font-color"
                full text-center text-wrap>
                <div style="padding-bottom: 5px;">
                  <b>{{ category.name }}</b>
                </div>
                <div *ngIf="selectedDataDimension[categoryIndex]">{{ selectedDataDimension[categoryIndex].name }}</div>
                <div *ngIf="!selectedDataDimension[categoryIndex]">
                  <span>{{translationMapper['Touch to select option'] }}</span>
                </div>
              </div>
            </div>
          </div>
          <div class="item-card" padding-top padding-bottom *ngIf="!isDataSetDimensionApplicable">
            <warning [warningMessage]="isDataSetDimensionApplicableCategories"></warning>
          </div>
        </div>
        <div *ngIf="isFormReady" full>
          <div>
            <div class="item-card">
              <ion-input type="text" placeholder="{{translationMapper['Mobile Number'] }}" [(ngModel)]="sendDataViaSmsObject.mobileNumber"></ion-input>
            </div>
            <button [color]="colorSettings.colorAttributes.secondary" (click)="sendDataViaSms()" [disabled]="sendDataViaSmsObject.mobileNumber.length < 9"
              ion-button style="text-transform: none;" block>{{ translationMapper['Upload data'] }}</button>
          </div>
        </div>
      </ion-col>
    </ion-row>
  </div>
</ion-grid>
